<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Admin List User</title>
<%@include file="include/admin-css.jsp"%>
</head>
<body>
	<%@include file="include/admin-header.jsp"%>
	<%@include file="include/admin-offcanvas.jsp"%>

	<div class="am-cf admin-main am-padding-left-lg default-background">
		<!-- content start -->
		<div class="admin-content">

			<div class="am-cf am-padding">
				<div class="am-fl am-cf">
					<a href="/admin/list"><strong class="am-text-primary am-text-lg">用户列表</strong></a> &nbsp;/&nbsp;&nbsp;&nbsp;
				</div>
				<div class="am-btn-toolbar am-fl">
					<div class="am-btn-group am-btn-group-xs">
						<a href="save" class="am-btn am-btn-default"> <span class="am-icon-plus"></span> 新增
						</a>
					</div>
				</div>
			</div>

			<hr />
			<div class="am-g">
				<div class="am-u-sm-12 am-text-truncate">
					<form class="am-form">
						<table class="am-table am-table-striped am-table-hover table-main am-text-truncate">
							<thead>
								<tr>
									<th class="table-check"><input type="checkbox" /></th>
									<th>序号</th>
									<th>电子邮箱</th>
									<th>姓名</th>
									<th>性别</th>
									<th>手机号码</th>
									<th>出生日期</th>
									<th>创建时间</th>
									<th style="width: 200px">操作</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach var="user" items="${userList}" varStatus="i">
									<tr>
										<td><input type="checkbox" /></td>
										<td>${i.index+1}</td>
										<td>${user.email}</td>
										<td>${user.realname}</td>
										<td><c:if test="${user.gender==0}">&nbsp;<span class="am-icon-male"></span>
											</c:if> <c:if test="${user.gender==1}">&nbsp;<span class="am-icon-female"></span>
											</c:if></td>
										<td>${user.mobile}</td>
										<td><fmt:formatDate value="${user.birthDate}" /></td>
										<td><fmt:formatDate value="${user.createDate}" /></td>
										<td>
											<div class="am-btn-toolbar">
												<div class="am-btn-group am-btn-group-xs">
													<a title="编辑" href="update/${user.id}" class="am-btn am-btn-default am-btn-xs am-text-secondary"> <span class="am-icon-pencil-square-o"></span> 编辑
													</a> <a onclick="confirm_delete(${user.id})" class="am-btn am-btn-default am-btn-xs am-text-danger"> <span class="am-icon-trash-o"></span> 删除
													</a>
												</div>
											</div>
										</td>
									</tr>
								</c:forEach>
							</tbody>
						</table>

						<div class="am-modal am-modal-confirm" tabindex="-1" id="confirm-alert">
							<div class="am-modal-dialog">
								<div class="am-modal-hd">
									<p class="am-text-danger">确定要删除</p>
								</div>
								<div class="am-modal-footer">
									<span class="am-modal-btn" data-am-modal-cancel>取消</span> <span class="am-modal-btn" data-am-modal-confirm>确定</span>
								</div>
							</div>
						</div>

						<div class="am-cf">
							<div class="am-fr">
								<ul class="am-pagination">
									<li class="am-disabled"><a href="#">«</a></li>
									<li class="am-active"><a href="#">1</a></li>
									<li><a href="#">2</a></li>
									<li><a href="#">3</a></li>
									<li><a href="#">4</a></li>
									<li><a href="#">5</a></li>
									<li><a href="#">»</a></li>
								</ul>
							</div>
						</div>
					</form>
				</div>

			</div>
		</div>
		<!-- content end -->
	</div>

	<%@include file="include/admin-js.jsp"%>
	<script type="text/javascript">
		function confirm_delete(deleteId) {
			$('#confirm-alert').modal({
				relatedElement : this,
				onConfirm : function() {
					window.location.href = "delete/"+deleteId;
				},
				onCancel : function() {
					return false;
				}
			});
		}
	</script>
</body>
</html>
